<template>
	<div  class="mainInfor">
		<h3><span><Icon type="person" size=24></Icon></span>个人信息</h3>
		 <Form :model="formItem" :label-width="80">
		 	<div class="left">
        <FormItem label="用户姓名"  prop="name">
            <Input v-model="formItem.input" placeholder="amy"></Input>
        </FormItem>
           <FormItem label="用户手机">
            <Input v-model="formItem.input" placeholder="177777777"></Input>
        </FormItem>
          <FormItem label="公司姓名">
            <Input v-model="formItem.input" placeholder="amy"></Input>
        </FormItem>
        <FormItem label="部门">
            <Input v-model="formItem.input" placeholder="项目管理部"></Input>
        </FormItem>
        <FormItem label="Select">
            <Select v-model="formItem.select">
                <Option value="beijing">New York</Option>
                <Option value="shanghai">London</Option>
                <Option value="shenzhen">Sydney</Option>
            </Select>
        </FormItem>
        </div>
        <div class="right"> 
     <el-upload
  class="avatar-uploader"
  action="https://jsonplaceholder.typicode.com/posts/"
  :show-file-list="false"
  :on-success="handleAvatarSuccess"
  :before-upload="beforeAvatarUpload">
  <img v-if="imageUrl" :src="imageUrl" class="avatar">
  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>

        </div>
    </Form>
		
	</div>
</template>
<script>
  export default {
    data() {
      return {
        imageUrl: ''
      };
    },
    methods: {
      handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
      },
      beforeAvatarUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
        return isJPG && isLt2M;
      }
    }
  }
</script>

<script>
   export default {
        data () {
            return {
                formItem: {
                    input: '',
                    select: '',
                    radio: 'male',
                    checkbox: [],
                    switch: true,
                    date: '',
                    time: '',
                    slider: [20, 50],
                    textarea: ''
                }
            }
        }
    }

</script>


<style type="text/css">
	.mainInfor{
		width: 70%;
		margin: 0 auto;
		border: solid 1px #e5e5e5;
		box-sizing: border-box;
		 margin-top: 20px;
		 border-radius: 5px;
		 height: 400px;}
		 .mainInfor span{padding-right: 5px;}
.mainInfor h3{
	padding-left: 10px; 
	height: 50px; 
	line-height: 30px; 
	font-size:18px; 
	font-weight: normal; 
	border-bottom: solid 1px #e5e5e5; 		
	padding: 10px;
}
.mainInfor .left{width: 60%; float: left; padding-right: 20%;}
.mainInfor .right:{width: 40%; float: left; text-align: center;}
.mainInfor:hover{
	  box-shadow:0 0 2px 3px rgba(0,0,0,.1);
}
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>